package com.jtny.nytb.weather.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.jtny.component.entity.WebResponse;
import com.jtny.nytb.weather.entity.vo.WeatherBasicInfoPageQueryParamVO;
import com.jtny.nytb.weather.service.ConfigResultsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(value = "配置结果信息管理", tags = "配置结果信息管理")
@RestController
@RequestMapping("/configResults")
public class ConfigResultsController {

    @Resource
    private ConfigResultsService configResultsService;

    @ApiOperation("分页查询配置结果页面信息")
    @ApiImplicitParam(name = "weatherBasicInfoPageQueryParamVO", value = "天气基础信息查询条件", required = true, paramType = "query", dataType = "WeatherBasicInfoPageQueryParamVO")
    @ApiOperationSupport(order = 1)
    @PostMapping("/pageQueryByBasicInfo")
    @ResponseBody
    public WebResponse<?> pageQueryByBasicInfo(@RequestBody WeatherBasicInfoPageQueryParamVO weatherBasicInfoPageQueryParamVO) {
        return WebResponse.success("操作成功", configResultsService.pageQueryByBasicInfo(weatherBasicInfoPageQueryParamVO));
    }

    @ApiOperation("查询关联基础信息的字段列表")
    @ApiImplicitParam(name = "id", value = "主键id", required = true, paramType = "path")
    @ApiOperationSupport(order = 2)
    @PostMapping("/selectFieldByBasicInfo/{id}")
    @ResponseBody
    public WebResponse<?> selectFieldByBasicInfo(@PathVariable Long id) {
        return WebResponse.success("操作成功", configResultsService.selectFieldByBasicInfo(id));
    }

    @ApiOperation("查询字段返回详细信息列表")
    @ApiImplicitParam(name = "id", value = "主键id", required = true, paramType = "path")
    @ApiOperationSupport(order = 3)
    @PostMapping("/selectFieldValueByBasicInfo/{id}")
    @ResponseBody
    public WebResponse<?> selectFieldValueByBasicInfo(@PathVariable Long id) {
        return WebResponse.success("操作成功", configResultsService.selectFieldValueByBasicInfo(id));
    }

    @ApiOperation("查询天气信息类型")
    @ApiOperationSupport(order = 4)
    @PostMapping("/selectWeatherInfoType")
    @ResponseBody
    public WebResponse<?> selectWeatherInfoType() {
        return WebResponse.success("操作成功", configResultsService.selectWeatherInfoType());
    }

}
